package com.example.usb.greendao;

import java.util.List;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.query.Query;
import org.greenrobot.greendao.query.QueryBuilder;

import com.example.usb.dao.entity.FaceInfoBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "FACE_INFO_BEAN".
*/
public class FaceInfoBeanDao extends AbstractDao<FaceInfoBean, String> {

    public static final String TABLENAME = "FACE_INFO_BEAN";

    /**
     * Properties of entity FaceInfoBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Uuid = new Property(0, String.class, "uuid", true, "UUID");
        public final static Property FaceMd5 = new Property(1, String.class, "faceMd5", false, "face_md5");
        public final static Property Figure = new Property(2, String.class, "figure", false, "figure");
        public final static Property FaceScore = new Property(3, double.class, "faceScore", false, "face_score");
        public final static Property FileHeadPath = new Property(4, String.class, "fileHeadPath", false, "file_head_path");
        public final static Property SecondHeadPath = new Property(5, String.class, "secondHeadPath", false, "second_head_path");
        public final static Property PhotoCompressPath = new Property(6, String.class, "photoCompressPath", false, "photo_compress_path");
        public final static Property FaceToken = new Property(7, String.class, "faceToken", false, "face_token");
        public final static Property LocationLeft = new Property(8, double.class, "locationLeft", false, "location_left");
        public final static Property LocationTop = new Property(9, double.class, "locationTop", false, "location_top");
        public final static Property LocationWidth = new Property(10, double.class, "locationWidth", false, "location_width");
        public final static Property LocationHeight = new Property(11, double.class, "locationHeight", false, "location_height");
        public final static Property LocationRotation = new Property(12, double.class, "locationRotation", false, "location_rotation");
        public final static Property FaceProbability = new Property(13, double.class, "faceProbability", false, "face_probability");
        public final static Property Age = new Property(14, int.class, "age", false, "age");
        public final static Property Beauty = new Property(15, double.class, "beauty", false, "beauty");
        public final static Property Yaw = new Property(16, double.class, "yaw", false, "yaw");
        public final static Property Pitch = new Property(17, double.class, "pitch", false, "pitch");
        public final static Property Roll = new Property(18, double.class, "roll", false, "roll");
        public final static Property SmlieType = new Property(19, String.class, "smlieType", false, "smlie_type");
        public final static Property SmlieProbability = new Property(20, double.class, "smlieProbability", false, "expression_probability");
        public final static Property FaceshapeType = new Property(21, String.class, "faceshapeType", false, "faceshape_type");
        public final static Property FaceshapeProbability = new Property(22, double.class, "faceshapeProbability", false, "faceshape_probability");
        public final static Property GenderType = new Property(23, String.class, "genderType", false, "gender_type");
        public final static Property GenderProbability = new Property(24, double.class, "genderProbability", false, "gender_probability");
        public final static Property GlassType = new Property(25, String.class, "glassType", false, "glass_type");
        public final static Property GlassProbability = new Property(26, double.class, "glassProbability", false, "glass_probability");
        public final static Property Blur = new Property(27, double.class, "blur", false, "blur");
        public final static Property Illumination = new Property(28, double.class, "illumination", false, "illumination");
        public final static Property Completeness = new Property(29, double.class, "completeness", false, "completeness");
        public final static Property LeftEye = new Property(30, double.class, "leftEye", false, "left_eye");
        public final static Property RightEye = new Property(31, double.class, "rightEye", false, "right_eye");
        public final static Property Nose = new Property(32, double.class, "nose", false, "nose");
        public final static Property Mouth = new Property(33, double.class, "mouth", false, "mouth");
        public final static Property LefCheek = new Property(34, double.class, "lefCheek", false, "left_cheek");
        public final static Property RightCheek = new Property(35, double.class, "rightCheek", false, "right_cheek");
        public final static Property ChinContour = new Property(36, double.class, "chinContour", false, "chin_contour");
        public final static Property FaceType = new Property(37, String.class, "faceType", false, "face_type");
        public final static Property FacetypeProbability = new Property(38, String.class, "facetypeProbability", false, "facetype_probability");
    }

    private Query<FaceInfoBean> photoPicBean_FaceListQuery;

    public FaceInfoBeanDao(DaoConfig config) {
        super(config);
    }
    
    public FaceInfoBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"FACE_INFO_BEAN\" (" + //
                "\"UUID\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid
                "\"face_md5\" TEXT," + // 1: faceMd5
                "\"figure\" TEXT," + // 2: figure
                "\"face_score\" REAL NOT NULL ," + // 3: faceScore
                "\"file_head_path\" TEXT," + // 4: fileHeadPath
                "\"second_head_path\" TEXT," + // 5: secondHeadPath
                "\"photo_compress_path\" TEXT," + // 6: photoCompressPath
                "\"face_token\" TEXT," + // 7: faceToken
                "\"location_left\" REAL NOT NULL ," + // 8: locationLeft
                "\"location_top\" REAL NOT NULL ," + // 9: locationTop
                "\"location_width\" REAL NOT NULL ," + // 10: locationWidth
                "\"location_height\" REAL NOT NULL ," + // 11: locationHeight
                "\"location_rotation\" REAL NOT NULL ," + // 12: locationRotation
                "\"face_probability\" REAL NOT NULL ," + // 13: faceProbability
                "\"age\" INTEGER NOT NULL ," + // 14: age
                "\"beauty\" REAL NOT NULL ," + // 15: beauty
                "\"yaw\" REAL NOT NULL ," + // 16: yaw
                "\"pitch\" REAL NOT NULL ," + // 17: pitch
                "\"roll\" REAL NOT NULL ," + // 18: roll
                "\"smlie_type\" TEXT," + // 19: smlieType
                "\"expression_probability\" REAL NOT NULL ," + // 20: smlieProbability
                "\"faceshape_type\" TEXT," + // 21: faceshapeType
                "\"faceshape_probability\" REAL NOT NULL ," + // 22: faceshapeProbability
                "\"gender_type\" TEXT," + // 23: genderType
                "\"gender_probability\" REAL NOT NULL ," + // 24: genderProbability
                "\"glass_type\" TEXT," + // 25: glassType
                "\"glass_probability\" REAL NOT NULL ," + // 26: glassProbability
                "\"blur\" REAL NOT NULL ," + // 27: blur
                "\"illumination\" REAL NOT NULL ," + // 28: illumination
                "\"completeness\" REAL NOT NULL ," + // 29: completeness
                "\"left_eye\" REAL NOT NULL ," + // 30: leftEye
                "\"right_eye\" REAL NOT NULL ," + // 31: rightEye
                "\"nose\" REAL NOT NULL ," + // 32: nose
                "\"mouth\" REAL NOT NULL ," + // 33: mouth
                "\"left_cheek\" REAL NOT NULL ," + // 34: lefCheek
                "\"right_cheek\" REAL NOT NULL ," + // 35: rightCheek
                "\"chin_contour\" REAL NOT NULL ," + // 36: chinContour
                "\"face_type\" TEXT," + // 37: faceType
                "\"facetype_probability\" TEXT);"); // 38: facetypeProbability
        // Add Indexes
        db.execSQL("CREATE INDEX " + constraint + "IDX_FACE_INFO_BEAN_figure ON \"FACE_INFO_BEAN\"" +
                " (\"figure\" ASC);");
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FACE_INFO_BEAN\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, FaceInfoBean entity) {
        stmt.clearBindings();
 
        String uuid = entity.getUuid();
        if (uuid != null) {
            stmt.bindString(1, uuid);
        }
 
        String faceMd5 = entity.getFaceMd5();
        if (faceMd5 != null) {
            stmt.bindString(2, faceMd5);
        }
 
        String figure = entity.getFigure();
        if (figure != null) {
            stmt.bindString(3, figure);
        }
        stmt.bindDouble(4, entity.getFaceScore());
 
        String fileHeadPath = entity.getFileHeadPath();
        if (fileHeadPath != null) {
            stmt.bindString(5, fileHeadPath);
        }
 
        String secondHeadPath = entity.getSecondHeadPath();
        if (secondHeadPath != null) {
            stmt.bindString(6, secondHeadPath);
        }
 
        String photoCompressPath = entity.getPhotoCompressPath();
        if (photoCompressPath != null) {
            stmt.bindString(7, photoCompressPath);
        }
 
        String faceToken = entity.getFaceToken();
        if (faceToken != null) {
            stmt.bindString(8, faceToken);
        }
        stmt.bindDouble(9, entity.getLocationLeft());
        stmt.bindDouble(10, entity.getLocationTop());
        stmt.bindDouble(11, entity.getLocationWidth());
        stmt.bindDouble(12, entity.getLocationHeight());
        stmt.bindDouble(13, entity.getLocationRotation());
        stmt.bindDouble(14, entity.getFaceProbability());
        stmt.bindLong(15, entity.getAge());
        stmt.bindDouble(16, entity.getBeauty());
        stmt.bindDouble(17, entity.getYaw());
        stmt.bindDouble(18, entity.getPitch());
        stmt.bindDouble(19, entity.getRoll());
 
        String smlieType = entity.getSmlieType();
        if (smlieType != null) {
            stmt.bindString(20, smlieType);
        }
        stmt.bindDouble(21, entity.getSmlieProbability());
 
        String faceshapeType = entity.getFaceshapeType();
        if (faceshapeType != null) {
            stmt.bindString(22, faceshapeType);
        }
        stmt.bindDouble(23, entity.getFaceshapeProbability());
 
        String genderType = entity.getGenderType();
        if (genderType != null) {
            stmt.bindString(24, genderType);
        }
        stmt.bindDouble(25, entity.getGenderProbability());
 
        String glassType = entity.getGlassType();
        if (glassType != null) {
            stmt.bindString(26, glassType);
        }
        stmt.bindDouble(27, entity.getGlassProbability());
        stmt.bindDouble(28, entity.getBlur());
        stmt.bindDouble(29, entity.getIllumination());
        stmt.bindDouble(30, entity.getCompleteness());
        stmt.bindDouble(31, entity.getLeftEye());
        stmt.bindDouble(32, entity.getRightEye());
        stmt.bindDouble(33, entity.getNose());
        stmt.bindDouble(34, entity.getMouth());
        stmt.bindDouble(35, entity.getLefCheek());
        stmt.bindDouble(36, entity.getRightCheek());
        stmt.bindDouble(37, entity.getChinContour());
 
        String faceType = entity.getFaceType();
        if (faceType != null) {
            stmt.bindString(38, faceType);
        }
 
        String facetypeProbability = entity.getFacetypeProbability();
        if (facetypeProbability != null) {
            stmt.bindString(39, facetypeProbability);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, FaceInfoBean entity) {
        stmt.clearBindings();
 
        String uuid = entity.getUuid();
        if (uuid != null) {
            stmt.bindString(1, uuid);
        }
 
        String faceMd5 = entity.getFaceMd5();
        if (faceMd5 != null) {
            stmt.bindString(2, faceMd5);
        }
 
        String figure = entity.getFigure();
        if (figure != null) {
            stmt.bindString(3, figure);
        }
        stmt.bindDouble(4, entity.getFaceScore());
 
        String fileHeadPath = entity.getFileHeadPath();
        if (fileHeadPath != null) {
            stmt.bindString(5, fileHeadPath);
        }
 
        String secondHeadPath = entity.getSecondHeadPath();
        if (secondHeadPath != null) {
            stmt.bindString(6, secondHeadPath);
        }
 
        String photoCompressPath = entity.getPhotoCompressPath();
        if (photoCompressPath != null) {
            stmt.bindString(7, photoCompressPath);
        }
 
        String faceToken = entity.getFaceToken();
        if (faceToken != null) {
            stmt.bindString(8, faceToken);
        }
        stmt.bindDouble(9, entity.getLocationLeft());
        stmt.bindDouble(10, entity.getLocationTop());
        stmt.bindDouble(11, entity.getLocationWidth());
        stmt.bindDouble(12, entity.getLocationHeight());
        stmt.bindDouble(13, entity.getLocationRotation());
        stmt.bindDouble(14, entity.getFaceProbability());
        stmt.bindLong(15, entity.getAge());
        stmt.bindDouble(16, entity.getBeauty());
        stmt.bindDouble(17, entity.getYaw());
        stmt.bindDouble(18, entity.getPitch());
        stmt.bindDouble(19, entity.getRoll());
 
        String smlieType = entity.getSmlieType();
        if (smlieType != null) {
            stmt.bindString(20, smlieType);
        }
        stmt.bindDouble(21, entity.getSmlieProbability());
 
        String faceshapeType = entity.getFaceshapeType();
        if (faceshapeType != null) {
            stmt.bindString(22, faceshapeType);
        }
        stmt.bindDouble(23, entity.getFaceshapeProbability());
 
        String genderType = entity.getGenderType();
        if (genderType != null) {
            stmt.bindString(24, genderType);
        }
        stmt.bindDouble(25, entity.getGenderProbability());
 
        String glassType = entity.getGlassType();
        if (glassType != null) {
            stmt.bindString(26, glassType);
        }
        stmt.bindDouble(27, entity.getGlassProbability());
        stmt.bindDouble(28, entity.getBlur());
        stmt.bindDouble(29, entity.getIllumination());
        stmt.bindDouble(30, entity.getCompleteness());
        stmt.bindDouble(31, entity.getLeftEye());
        stmt.bindDouble(32, entity.getRightEye());
        stmt.bindDouble(33, entity.getNose());
        stmt.bindDouble(34, entity.getMouth());
        stmt.bindDouble(35, entity.getLefCheek());
        stmt.bindDouble(36, entity.getRightCheek());
        stmt.bindDouble(37, entity.getChinContour());
 
        String faceType = entity.getFaceType();
        if (faceType != null) {
            stmt.bindString(38, faceType);
        }
 
        String facetypeProbability = entity.getFacetypeProbability();
        if (facetypeProbability != null) {
            stmt.bindString(39, facetypeProbability);
        }
    }

    @Override
    public String readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
    }    

    @Override
    public FaceInfoBean readEntity(Cursor cursor, int offset) {
        FaceInfoBean entity = new FaceInfoBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // uuid
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // faceMd5
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // figure
            cursor.getDouble(offset + 3), // faceScore
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // fileHeadPath
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // secondHeadPath
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // photoCompressPath
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // faceToken
            cursor.getDouble(offset + 8), // locationLeft
            cursor.getDouble(offset + 9), // locationTop
            cursor.getDouble(offset + 10), // locationWidth
            cursor.getDouble(offset + 11), // locationHeight
            cursor.getDouble(offset + 12), // locationRotation
            cursor.getDouble(offset + 13), // faceProbability
            cursor.getInt(offset + 14), // age
            cursor.getDouble(offset + 15), // beauty
            cursor.getDouble(offset + 16), // yaw
            cursor.getDouble(offset + 17), // pitch
            cursor.getDouble(offset + 18), // roll
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // smlieType
            cursor.getDouble(offset + 20), // smlieProbability
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // faceshapeType
            cursor.getDouble(offset + 22), // faceshapeProbability
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // genderType
            cursor.getDouble(offset + 24), // genderProbability
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // glassType
            cursor.getDouble(offset + 26), // glassProbability
            cursor.getDouble(offset + 27), // blur
            cursor.getDouble(offset + 28), // illumination
            cursor.getDouble(offset + 29), // completeness
            cursor.getDouble(offset + 30), // leftEye
            cursor.getDouble(offset + 31), // rightEye
            cursor.getDouble(offset + 32), // nose
            cursor.getDouble(offset + 33), // mouth
            cursor.getDouble(offset + 34), // lefCheek
            cursor.getDouble(offset + 35), // rightCheek
            cursor.getDouble(offset + 36), // chinContour
            cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // faceType
            cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38) // facetypeProbability
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, FaceInfoBean entity, int offset) {
        entity.setUuid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setFaceMd5(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setFigure(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setFaceScore(cursor.getDouble(offset + 3));
        entity.setFileHeadPath(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setSecondHeadPath(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setPhotoCompressPath(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setFaceToken(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setLocationLeft(cursor.getDouble(offset + 8));
        entity.setLocationTop(cursor.getDouble(offset + 9));
        entity.setLocationWidth(cursor.getDouble(offset + 10));
        entity.setLocationHeight(cursor.getDouble(offset + 11));
        entity.setLocationRotation(cursor.getDouble(offset + 12));
        entity.setFaceProbability(cursor.getDouble(offset + 13));
        entity.setAge(cursor.getInt(offset + 14));
        entity.setBeauty(cursor.getDouble(offset + 15));
        entity.setYaw(cursor.getDouble(offset + 16));
        entity.setPitch(cursor.getDouble(offset + 17));
        entity.setRoll(cursor.getDouble(offset + 18));
        entity.setSmlieType(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setSmlieProbability(cursor.getDouble(offset + 20));
        entity.setFaceshapeType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setFaceshapeProbability(cursor.getDouble(offset + 22));
        entity.setGenderType(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setGenderProbability(cursor.getDouble(offset + 24));
        entity.setGlassType(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setGlassProbability(cursor.getDouble(offset + 26));
        entity.setBlur(cursor.getDouble(offset + 27));
        entity.setIllumination(cursor.getDouble(offset + 28));
        entity.setCompleteness(cursor.getDouble(offset + 29));
        entity.setLeftEye(cursor.getDouble(offset + 30));
        entity.setRightEye(cursor.getDouble(offset + 31));
        entity.setNose(cursor.getDouble(offset + 32));
        entity.setMouth(cursor.getDouble(offset + 33));
        entity.setLefCheek(cursor.getDouble(offset + 34));
        entity.setRightCheek(cursor.getDouble(offset + 35));
        entity.setChinContour(cursor.getDouble(offset + 36));
        entity.setFaceType(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37));
        entity.setFacetypeProbability(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38));
     }
    
    @Override
    protected final String updateKeyAfterInsert(FaceInfoBean entity, long rowId) {
        return entity.getUuid();
    }
    
    @Override
    public String getKey(FaceInfoBean entity) {
        if(entity != null) {
            return entity.getUuid();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(FaceInfoBean entity) {
        return entity.getUuid() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
    /** Internal query to resolve the "faceList" to-many relationship of PhotoPicBean. */
    public List<FaceInfoBean> _queryPhotoPicBean_FaceList(String faceMd5) {
        synchronized (this) {
            if (photoPicBean_FaceListQuery == null) {
                QueryBuilder<FaceInfoBean> queryBuilder = queryBuilder();
                queryBuilder.where(Properties.FaceMd5.eq(null));
                photoPicBean_FaceListQuery = queryBuilder.build();
            }
        }
        Query<FaceInfoBean> query = photoPicBean_FaceListQuery.forCurrentThread();
        query.setParameter(0, faceMd5);
        return query.list();
    }

}
